 begintownscript;

 variables;

 int i,j,k,r1,choice;

 body;
beginstate INIT_STATE;

	set_name(6,"Captain Griffith");
	set_name(13,"Benedict");
	set_name(14,"Cute Puppy");
	set_name(15,"Trisha");
	set_name(17,"Harold");
	set_name(20,"Carol");
	set_name(25,"Cook");
	set_name(31,"Rick");

	set_crime_tolerance(1);

	if (get_flag(0,3) == 1)
		set_terrain(24,4,68);

	if ((get_flag(17,17) >= 2) && (get_flag(17,9) == 1))
		message_dialog("You return victorious to Fort Laramie. The only thing that remains now is to return to the Empire mainlands and report what has happened here.","");
		
 break;

beginstate START_STATE;

	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(7,"Blast!");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(7,"A-ha!");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(8,"Curses!");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(8,"Got you now!");
	if (get_ran(1,0,100) < 10)
		text_bubble_on_char(14,"Woof!");

 break;

beginstate EXIT_STATE;

break;	

beginstate 10;
	reset_dialog();
	add_dialog_str(1,"You throw a quick glimpse at the ascetic room you were provided. You could rest here if you wanted to.",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Rest for a little while");
	choice = run_dialog(1);
	if (choice == 2) {
		revive_party();
		set_ticks_forward(100);
	}
break;

beginstate 11;
	if (get_flag(0,8) == 0)
		message_dialog("You step outside of the inn, taking a good look at the fort. It looks different in daylight. For one thing it looks as if it's deserted. Soldiers are nowhere to be seen."," The fort is quiet, apart from a bark now and then.");
	set_flag(0,8,1);
 break;

beginstate 12;
	if (get_flag(0,9) == 0)
		message_dialog("This building is different from all the other buildings of the fort. Its walls are made of thick stone and there is a faint smell of various herbs in the air.","");
	set_flag(0,9,1);

 break;

beginstate 13;
	if (get_flag(0,10) == 0)
	reset_dialog();
	add_dialog_str(0,"This is Benedict's cauldron it's lid is currently closed so you decide to peek in. Benedict swarms at you, just before you open the lid. _What are you doing? Don't touch that! You might disrupt the process._ Benedict motions you to back away.",0);
	add_dialog_choice(0,"Leave the cauldron be.");
	add_dialog_choice(1,"Open the lid.");
	choice = run_dialog(1);
	if (choice == 2) 
		set_state_continue(15);

 break;


beginstate 15;
	message_dialog("Opening the lid was not a smart thing to do. As soon as you open the lid the brewing inside starts to sizzle. Benedict jumps behind a table and the cauldron explodes.","");
	relocate_character(13,29,6);
	put_boom_on_space(32,8,1,0);
	swap_terrain(32,8,249,137);
	damage_near_loc(32,8,20,2,1);
	set_flag(0,10,1);
break;

 beginstate 16;
	reset_dialog();
	add_dialog_str(0,"This road leads back to Empire heartland. If you are ready to head back pursue on this road.",0);
	add_dialog_choice(0,"I'm not finished yet!");
	add_dialog_choice(1,"End the scenario");
	choice = run_dialog(0);

	if (choice == 2) {
		if (get_flag(17,17) == 0) {
			message_dialog("You can't take this anymore! You head out and try to get as far away as you can from Faerengrove. What's happening here is none of your concern.","However months elapses and a terrible evil arose from Faerengrove. The Empire needed to concentrate all its forces in order to stop it. If something would have been done sooner, a lot of lives would have been spared.");
			end_scenario(0);
}
		if (get_flag(17,17) >= 2) {
			reset_dialog();
			add_dialog_str(0,"You start the long journey back to civilization. On the way, you try to figure out what to say to your employer; so that you wouldn't sound like a lunatic.",0);
			if (get_flag(7,3) == 3)
				add_dialog_str(1,"You fought stronger goblins, slithzerikai and demons. You even met a friendly vampire. The trip back is as uneventful as your mission should have been. You face your employer and tell him everything.",0);
			if (get_flag(8,1) > 2)
				add_dialog_str(2,"You fought stronger goblins, slithzerikai, a vampire and demons. The trip back is as uneventful as your mission should have been. You face your employer and tell him everything.",0);
			add_dialog_str(3,"He stares at you in disbelief; some of his aides are smirking. The explanation and the following paperwork takes a lot longer than you would have desired. Fortunately something relieves you from the burden - a caravan from Faerengrove.",0);
			add_dialog_str(4,"Although the caravan is small and has very little iron the caravan drivers and guards verify your story. You are generously rewarded. You did, after all, save the Empire from a full-scale demon war.",0);
			add_dialog_choice(0,"THE END.");
			run_dialog(1);
			change_coins(5000);
			end_scenario(1);
}
}
	block_entry(1);	
break;

 beginstate 17;
	if (get_flag(0,13) == 0) {
		message_dialog("You take a look at the equipment in the warehouse. Put bluntly: it's junk. While an inexperienced adventurers might consider this a bounty, you've seen far better.","This doesn't make you optimistic on what else you might find in Faerengrove.");
		set_flag(0,13,1);
}
 break;
	
